﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing.Text;
using System.Drawing;
using System.Drawing.Drawing2D;

namespace TextEditor.TextDocument.Element
{
    public class ZYTextRadio : ZYTextCheck
    {
        public override string GetXMLName()
        {
            return "radiobutton";
        }

        public override bool RefreshView()
        {
            int y = this.myBounds.Top;
            SmoothingMode oldSmothing = this.OwnerDocument.View.Graph.SmoothingMode;
            this.OwnerDocument.View.Graph.SmoothingMode = SmoothingMode.AntiAlias;
            Rectangle rec = new Rectangle(this.Bounds.Left + 2, this.Bounds.Top, this.Bounds.Width - 4, this.Bounds.Height - 1);
            base.myOwnerDocument.View.Graph.DrawEllipse(this.OwnerDocument.View._CreatePen(Color.Black, 1), rec);
            if (this.check == "Y")
            {
                base.myOwnerDocument.View.Graph.FillEllipse(this.OwnerDocument.View._CreateBrush(Color.Black), rec.X + 4, rec.Y + 4, rec.Width - 8, rec.Height - 8);
            }
            this.OwnerDocument.View.Graph.SmoothingMode = oldSmothing;
            return true;
        }
    }
}
